/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Views;

import Controleur.Embarcadere;
import Controleur.Embarcation;
import Controleur.Excursion;
import Controleur.Moniteur;
import Controleur.Participant;
import DAO.ConnexionDB;
import DAO.EmbarcadereDAO;
import DAO.ExcursionDAO;
import DAO.MoniteurDAO;
import DAO.ParticipantDAO;
import java.sql.SQLException;
import java.sql.Time;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Valentin
 */
public class FrmEcoPag extends javax.swing.JFrame {

    Map<Integer, Participant> myMapParticipant;
    Map<Integer, Moniteur> myMapMoniteur;
    Map<Integer, Excursion> myMapExcursion;
    Map<Integer, Embarcadere> myMapEmbarcadere;
    Map<Integer, Embarcation> myMapEmbarcation;
    DefaultTableModel TabExcursionModel;
    DefaultTableModel TabInscriptionModel;
    Excursion currentExcursion;

    /**
     * Creates new form FrmEcoPag
     */
    public FrmEcoPag() {
        initVariables();
        initComponents();
        LoadCBoxParticipants();
        loadExcursions();
        loadEmbarcadereList();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jCheckBoxMenuItem1 = new javax.swing.JCheckBoxMenuItem();
        jCheckBoxMenuItem2 = new javax.swing.JCheckBoxMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        TabExcursion = new javax.swing.JTable();
        jScrollPane3 = new javax.swing.JScrollPane();
        TableauInscription = new javax.swing.JTable();
        PanelParticipants = new javax.swing.JPanel();
        ComboBoxParticipants = new javax.swing.JComboBox();
        NomParticipant = new javax.swing.JTextField();
        prenomParticipant = new javax.swing.JTextField();
        ageParticipant = new javax.swing.JTextField();
        departementParticipant = new javax.swing.JTextField();
        ModifyParticipantButton = new javax.swing.JButton();
        createParticipantButton = new javax.swing.JButton();
        deleteParticipantButton = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        PanelExcursions = new javax.swing.JPanel();
        EmbarcadereArrivee = new javax.swing.JComboBox();
        EmbarcadereDepart = new javax.swing.JComboBox();
        ComboEmbarcation = new javax.swing.JComboBox();
        jSpinner1 = new javax.swing.JSpinner();
        jSpinner2 = new javax.swing.JSpinner();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        DateExcursion = new com.toedter.calendar.JDateChooser();
        boutonCreationExcursion = new javax.swing.JButton();
        boutonModificationExcursion = new javax.swing.JButton();
        caseTextPrix = new javax.swing.JTextField();
        caseTextPlaceDispo = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        ComboBoxMoniteurs = new javax.swing.JComboBox();
        jLabel14 = new javax.swing.JLabel();
        PanelMoniteurs1 = new javax.swing.JPanel();

        jCheckBoxMenuItem1.setSelected(true);
        jCheckBoxMenuItem1.setText("jCheckBoxMenuItem1");

        jCheckBoxMenuItem2.setSelected(true);
        jCheckBoxMenuItem2.setText("jCheckBoxMenuItem2");

        jMenu1.setText("jMenu1");

        jMenu2.setText("jMenu2");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
        });

        jTabbedPane1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N

        TabExcursion.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Date", "Embarcation", "Départ", "Heure", "Arrivée", "Heure", "Prix", "Place dispo."
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Object.class, java.lang.String.class, java.lang.Object.class, java.lang.String.class, java.lang.Object.class, java.lang.Float.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        TabExcursion.setFocusable(false);
        TabExcursion.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TabExcursionMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(TabExcursion);
        TabExcursion.getColumnModel().getColumn(0).setPreferredWidth(10);
        TabExcursion.getColumnModel().getColumn(1).setPreferredWidth(30);
        TabExcursion.getColumnModel().getColumn(3).setPreferredWidth(10);
        TabExcursion.getColumnModel().getColumn(5).setPreferredWidth(10);
        TabExcursion.getColumnModel().getColumn(6).setPreferredWidth(10);
        TabExcursion.getColumnModel().getColumn(7).setPreferredWidth(10);

        TableauInscription.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Participant", "Inscription", "Location"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Boolean.class, java.lang.Boolean.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        TableauInscription.setFocusable(false);
        TableauInscription.setRowSelectionAllowed(false);
        TableauInscription.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TableauInscriptionMouseClicked(evt);
            }
        });
        TableauInscription.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                TableauInscriptionPropertyChange(evt);
            }
        });
        jScrollPane3.setViewportView(TableauInscription);
        TableauInscription.getColumnModel().getColumn(1).setPreferredWidth(10);
        TableauInscription.getColumnModel().getColumn(2).setPreferredWidth(10);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 655, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 591, Short.MAX_VALUE)
                    .addComponent(jScrollPane3))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Inscriptions", jPanel1);

        ComboBoxParticipants.setFont(new java.awt.Font("Tahoma", 2, 18)); // NOI18N
        ComboBoxParticipants.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Participants" }));
        ComboBoxParticipants.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ComboBoxParticipantsMouseClicked(evt);
            }
        });
        ComboBoxParticipants.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ComboBoxParticipantsItemStateChanged(evt);
            }
        });
        ComboBoxParticipants.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ComboBoxParticipantsActionPerformed(evt);
            }
        });

        NomParticipant.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        NomParticipant.setText("Nom");
        NomParticipant.setToolTipText("Nom");
        NomParticipant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                NomParticipantActionPerformed(evt);
            }
        });
        NomParticipant.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                NomParticipantFocusGained(evt);
            }
        });

        prenomParticipant.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        prenomParticipant.setText("Prénom");
        prenomParticipant.setToolTipText("Prénom");
        prenomParticipant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                prenomParticipantActionPerformed(evt);
            }
        });
        prenomParticipant.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                prenomParticipantFocusGained(evt);
            }
        });

        ageParticipant.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        ageParticipant.setText("Age");
        ageParticipant.setToolTipText("Age");
        ageParticipant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ageParticipantActionPerformed(evt);
            }
        });
        ageParticipant.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                ageParticipantFocusGained(evt);
            }
        });

        departementParticipant.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        departementParticipant.setText("Dpt.");
        departementParticipant.setToolTipText("N° de département");
        departementParticipant.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                departementParticipantFocusGained(evt);
            }
        });

        ModifyParticipantButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        ModifyParticipantButton.setText("Modifier");
        ModifyParticipantButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ModifyParticipantButtonActionPerformed(evt);
            }
        });

        createParticipantButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        createParticipantButton.setText("Ajouter");
        createParticipantButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                createParticipantButtonActionPerformed(evt);
            }
        });

        deleteParticipantButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        deleteParticipantButton.setText("Supprimer");
        deleteParticipantButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteParticipantButtonActionPerformed(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel9.setText("Nom :");

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel10.setText("Prénom :");

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel11.setText("Age :");

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel12.setText("Département :");

        jLabel13.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel13.setText("Participant :");

        javax.swing.GroupLayout PanelParticipantsLayout = new javax.swing.GroupLayout(PanelParticipants);
        PanelParticipants.setLayout(PanelParticipantsLayout);
        PanelParticipantsLayout.setHorizontalGroup(
            PanelParticipantsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelParticipantsLayout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addGroup(PanelParticipantsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(departementParticipant, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(prenomParticipant, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(NomParticipant, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ComboBoxParticipants, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9)
                    .addComponent(jLabel10)
                    .addComponent(jLabel11)
                    .addComponent(jLabel13)
                    .addGroup(PanelParticipantsLayout.createSequentialGroup()
                        .addGroup(PanelParticipantsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PanelParticipantsLayout.createSequentialGroup()
                                .addComponent(deleteParticipantButton, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(ModifyParticipantButton, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(ageParticipant, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(createParticipantButton, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(528, Short.MAX_VALUE))
        );
        PanelParticipantsLayout.setVerticalGroup(
            PanelParticipantsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelParticipantsLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ComboBoxParticipants, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(NomParticipant, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(prenomParticipant, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ageParticipant, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
                .addComponent(departementParticipant, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(27, 27, 27)
                .addGroup(PanelParticipantsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(deleteParticipantButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ModifyParticipantButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(createParticipantButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(99, 99, 99))
        );

        jTabbedPane1.addTab("Participants", PanelParticipants);

        PanelExcursions.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                PanelExcursionsFocusGained(evt);
            }
        });

        jLabel1.setText("Date :");

        jLabel2.setText("Embarcation :");

        jLabel3.setText("Lieu de départ :");

        jLabel4.setText("Lieu d'arrivée :");

        jLabel5.setText("Heure :");

        jLabel6.setText("Heure :");

        boutonCreationExcursion.setText("Création Excursion");
        boutonCreationExcursion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boutonCreationExcursionActionPerformed(evt);
            }
        });

        boutonModificationExcursion.setText("Modification Excursion");
        boutonModificationExcursion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boutonModificationExcursionActionPerformed(evt);
            }
        });

        caseTextPrix.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                caseTextPrixActionPerformed(evt);
            }
        });

        caseTextPlaceDispo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                caseTextPlaceDispoActionPerformed(evt);
            }
        });

        jLabel7.setText("Prix :");

        jLabel8.setText("Place dispo:");

        ComboBoxMoniteurs.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        ComboBoxMoniteurs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ComboBoxMoniteursActionPerformed(evt);
            }
        });

        jLabel14.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel14.setText("Moniteurs :");

        javax.swing.GroupLayout PanelExcursionsLayout = new javax.swing.GroupLayout(PanelExcursions);
        PanelExcursions.setLayout(PanelExcursionsLayout);
        PanelExcursionsLayout.setHorizontalGroup(
            PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelExcursionsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelExcursionsLayout.createSequentialGroup()
                        .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(EmbarcadereDepart, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(EmbarcadereArrivee, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(61, 61, 61)
                        .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6)
                            .addComponent(jLabel5)
                            .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jSpinner1)
                                .addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel14)
                            .addComponent(ComboBoxMoniteurs, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(PanelExcursionsLayout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addComponent(boutonCreationExcursion)
                        .addGap(46, 46, 46)
                        .addComponent(boutonModificationExcursion))
                    .addGroup(PanelExcursionsLayout.createSequentialGroup()
                        .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addComponent(caseTextPrix, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(78, 78, 78)
                        .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(caseTextPlaceDispo)))
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(PanelExcursionsLayout.createSequentialGroup()
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(DateExcursion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(ComboEmbarcation, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(268, Short.MAX_VALUE))
        );
        PanelExcursionsLayout.setVerticalGroup(
            PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelExcursionsLayout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelExcursionsLayout.createSequentialGroup()
                        .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(DateExcursion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(22, 22, 22)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ComboEmbarcation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PanelExcursionsLayout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(ComboBoxMoniteurs, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel5))
                .addGap(3, 3, 3)
                .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(EmbarcadereDepart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel6))
                .addGap(3, 3, 3)
                .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(EmbarcadereArrivee, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(caseTextPlaceDispo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(caseTextPrix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(53, 53, 53)
                .addGroup(PanelExcursionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(boutonCreationExcursion)
                    .addComponent(boutonModificationExcursion))
                .addContainerGap(268, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Excursions", PanelExcursions);

        javax.swing.GroupLayout PanelMoniteurs1Layout = new javax.swing.GroupLayout(PanelMoniteurs1);
        PanelMoniteurs1.setLayout(PanelMoniteurs1Layout);
        PanelMoniteurs1Layout.setHorizontalGroup(
            PanelMoniteurs1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 921, Short.MAX_VALUE)
        );
        PanelMoniteurs1Layout.setVerticalGroup(
            PanelMoniteurs1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 617, Short.MAX_VALUE)
        );

        jTabbedPane1.addTab("Moniteurs", PanelMoniteurs1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 926, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
        TabExcursionModel = (DefaultTableModel) TabExcursion.getModel();
        TabInscriptionModel = (DefaultTableModel) TableauInscription.getModel();
        loadExcursions();
        LoadCBoxMoniteurs();
    }//GEN-LAST:event_formWindowActivated

    private void deleteParticipantButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteParticipantButtonActionPerformed
        try {
            Participant aParticipant = new Participant();
            ParticipantDAO DAO = new ParticipantDAO(ConnexionDB.getInstance());

            aParticipant = (Participant) ComboBoxParticipants.getSelectedItem();

            aParticipant.setNom(NomParticipant.getText());
            aParticipant.setPrenom(prenomParticipant.getText());
            aParticipant.setAge(Integer.parseInt(ageParticipant.getText()));
            aParticipant.setDepartement(Integer.parseInt(departementParticipant.getText()));
            DAO.delete(aParticipant);
            LoadCBoxParticipants();
        } catch (SQLException ex) {
            Logger.getLogger(FrmEcoPag.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_deleteParticipantButtonActionPerformed

    private void createParticipantButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createParticipantButtonActionPerformed
        try {
            Participant aParticipant = new Participant();
            ParticipantDAO DAO = new ParticipantDAO(ConnexionDB.getInstance());

            aParticipant.setNom(NomParticipant.getText());
            aParticipant.setPrenom(prenomParticipant.getText());
            aParticipant.setAge(Integer.parseInt(ageParticipant.getText()));
            aParticipant.setDepartement(Integer.parseInt(departementParticipant.getText()));
            DAO.insert(aParticipant);
            LoadCBoxParticipants();
        } catch (SQLException ex) {
            Logger.getLogger(FrmEcoPag.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_createParticipantButtonActionPerformed

    private void ModifyParticipantButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ModifyParticipantButtonActionPerformed
        try {
            Participant aParticipant = new Participant();
            ParticipantDAO DAO = new ParticipantDAO(ConnexionDB.getInstance());

            aParticipant = (Participant) ComboBoxParticipants.getSelectedItem();

            aParticipant.setNom(NomParticipant.getText());
            aParticipant.setPrenom(prenomParticipant.getText());
            aParticipant.setAge(Integer.parseInt(ageParticipant.getText()));
            aParticipant.setDepartement(Integer.parseInt(departementParticipant.getText()));
            DAO.update(aParticipant);
            LoadCBoxParticipants();
        } catch (SQLException ex) {
            Logger.getLogger(FrmEcoPag.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_ModifyParticipantButtonActionPerformed

    private void departementParticipantFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_departementParticipantFocusGained
        departementParticipant.selectAll();
    }//GEN-LAST:event_departementParticipantFocusGained

    private void ageParticipantFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ageParticipantFocusGained
        ageParticipant.selectAll();
    }//GEN-LAST:event_ageParticipantFocusGained

    private void prenomParticipantFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_prenomParticipantFocusGained
        prenomParticipant.selectAll();
    }//GEN-LAST:event_prenomParticipantFocusGained

    private void NomParticipantFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_NomParticipantFocusGained
        NomParticipant.selectAll();
    }//GEN-LAST:event_NomParticipantFocusGained

    private void ComboBoxParticipantsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ComboBoxParticipantsActionPerformed
        //  LoadCBoxParticipants();
    }//GEN-LAST:event_ComboBoxParticipantsActionPerformed

    private void ComboBoxParticipantsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ComboBoxParticipantsItemStateChanged
        Participant aParticipant = new Participant();

        if (ComboBoxParticipants.getSelectedItem() != null) {
            aParticipant = (Participant) ComboBoxParticipants.getSelectedItem();
            NomParticipant.setText(aParticipant.getNom());
            prenomParticipant.setText(aParticipant.getPrenom());
            ageParticipant.setText(Integer.toString(aParticipant.getAge()));
            departementParticipant.setText(Integer.toString(aParticipant.getDepartement()));
        }
    }//GEN-LAST:event_ComboBoxParticipantsItemStateChanged

    private void ComboBoxParticipantsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ComboBoxParticipantsMouseClicked
    }//GEN-LAST:event_ComboBoxParticipantsMouseClicked

    private void boutonCreationExcursionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boutonCreationExcursionActionPerformed
        try {
            ExcursionDAO DAO = new ExcursionDAO(ConnexionDB.getInstance());
            
            Excursion aExcursion = new Excursion();
            Embarcadere myEmbarcadereDepart = new Embarcadere();
            Embarcadere myEmbarcadereArrivee = new Embarcadere();
            
            myEmbarcadereDepart = (Embarcadere)EmbarcadereDepart.getSelectedItem();
            myEmbarcadereArrivee = (Embarcadere)EmbarcadereArrivee.getSelectedItem();
            
            myEmbarcadereDepart.setHeurePassage(null);
            myEmbarcadereArrivee.setHeurePassage(null);
            
            
            aExcursion.setEmbarcadereDepart(myEmbarcadereDepart);
            aExcursion.setEmbarcadereArrivee(myEmbarcadereArrivee);
            
            Long aTime;
            aTime = DateExcursion.getDate().getTime();
            aExcursion.setTime(aTime);
           
            aExcursion.setIdEmbarcation(1);
            
            aExcursion.setMoniteur((Moniteur)ComboBoxMoniteurs.getSelectedItem());
            
            aExcursion.setPrixPers(Double.parseDouble(caseTextPrix.getText()));
            
            aExcursion.setNbPlaces(Integer.parseInt(caseTextPlaceDispo.getText()));

            DAO.insert(aExcursion);
            
        } catch (SQLException ex) {
            Logger.getLogger(FrmEcoPag.class.getName()).log(Level.SEVERE, null, ex);
        }
        loadExcursions();
    }//GEN-LAST:event_boutonCreationExcursionActionPerformed

    private void boutonModificationExcursionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boutonModificationExcursionActionPerformed
        try {
            Excursion aExcursion = new Excursion();
            ExcursionDAO DAO = new ExcursionDAO(ConnexionDB.getInstance());


            //aExcursion.setPrixPers(Integer.parseInt(.getText()));
            //aExcursion.setNbPlaces(Integer.parseInt(departementParticipant.getText()));

            DAO.update(aExcursion);
        } catch (SQLException ex) {
            Logger.getLogger(FrmEcoPag.class.getName()).log(Level.SEVERE, null, ex);
        }
        loadExcursions();
    }//GEN-LAST:event_boutonModificationExcursionActionPerformed

    private void caseTextPrixActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_caseTextPrixActionPerformed
        caseTextPrix.selectAll();
    }//GEN-LAST:event_caseTextPrixActionPerformed

    private void caseTextPlaceDispoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_caseTextPlaceDispoActionPerformed
        caseTextPlaceDispo.selectAll();
    }//GEN-LAST:event_caseTextPlaceDispoActionPerformed

    private void TabExcursionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TabExcursionMouseClicked
        currentExcursion = (Excursion) TabExcursionModel.getValueAt(TabExcursion.getSelectedRow(), 1);
        loadInscriptionList();
    }//GEN-LAST:event_TabExcursionMouseClicked

    private void TableauInscriptionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TableauInscriptionMouseClicked
        ParticipantDAO myParticipantDAO = new ParticipantDAO(ConnexionDB.getInstance());
        ExcursionDAO myExcursionDAO = new ExcursionDAO(ConnexionDB.getInstance());
        Participant myParticipant = new Participant();
        boolean inscription , location;
        
        myParticipant = (Participant)TabInscriptionModel.getValueAt(TableauInscription.getSelectedRow(), 0);
        inscription = (boolean)TabInscriptionModel.getValueAt(TableauInscription.getSelectedRow(), 1);
        location = (boolean)TabInscriptionModel.getValueAt(TableauInscription.getSelectedRow(), 2);
        
        //Gestion du nombre de places restantes
        if (inscription && !myParticipant.isInscrit())
            currentExcursion.inscrire();        
        if (!inscription && myParticipant.isInscrit())
            currentExcursion.desinscrire();
        
        
        if(location && !inscription){
           TabInscriptionModel.setValueAt(false, TableauInscription.getSelectedRow(), 2); 
           myParticipant.setLocation(false);
           currentExcursion.getParticipant(myParticipant.getId()).setLocation(false);                       
        }        
                       
        
        myParticipant.setInscrit(inscription);
        myParticipant.setLocation(location);
        
        try {
            myParticipantDAO.inscription(myParticipant, currentExcursion.getId());
            myExcursionDAO.update(currentExcursion);
        } catch (SQLException ex) {
            Logger.getLogger(FrmEcoPag.class.getName()).log(Level.SEVERE, null, ex);
        }


    }//GEN-LAST:event_TableauInscriptionMouseClicked

    private void TableauInscriptionPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_TableauInscriptionPropertyChange
    }//GEN-LAST:event_TableauInscriptionPropertyChange

    private void ComboBoxMoniteursActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ComboBoxMoniteursActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ComboBoxMoniteursActionPerformed

    private void NomParticipantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NomParticipantActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_NomParticipantActionPerformed

    private void prenomParticipantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prenomParticipantActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_prenomParticipantActionPerformed

    private void ageParticipantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ageParticipantActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ageParticipantActionPerformed

    private void PanelExcursionsFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_PanelExcursionsFocusGained
        
    }//GEN-LAST:event_PanelExcursionsFocusGained

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrmEcoPag.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrmEcoPag.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrmEcoPag.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrmEcoPag.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FrmEcoPag().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox ComboBoxMoniteurs;
    private javax.swing.JComboBox ComboBoxParticipants;
    private javax.swing.JComboBox ComboEmbarcation;
    private com.toedter.calendar.JDateChooser DateExcursion;
    private javax.swing.JComboBox EmbarcadereArrivee;
    private javax.swing.JComboBox EmbarcadereDepart;
    private javax.swing.JButton ModifyParticipantButton;
    private javax.swing.JTextField NomParticipant;
    private javax.swing.JPanel PanelExcursions;
    private javax.swing.JPanel PanelMoniteurs1;
    private javax.swing.JPanel PanelParticipants;
    private javax.swing.JTable TabExcursion;
    private javax.swing.JTable TableauInscription;
    private javax.swing.JTextField ageParticipant;
    private javax.swing.JButton boutonCreationExcursion;
    private javax.swing.JButton boutonModificationExcursion;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JTextField caseTextPlaceDispo;
    private javax.swing.JTextField caseTextPrix;
    private javax.swing.JButton createParticipantButton;
    private javax.swing.JButton deleteParticipantButton;
    private javax.swing.JTextField departementParticipant;
    private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem1;
    private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSpinner jSpinner1;
    private javax.swing.JSpinner jSpinner2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField prenomParticipant;
    // End of variables declaration//GEN-END:variables

    private void LoadCBoxParticipants() {
        


        ParticipantDAO myParticipantDAO = new ParticipantDAO(ConnexionDB.getInstance());
        myMapParticipant.clear();
        ComboBoxParticipants.removeAllItems();
        try {
            myMapParticipant = myParticipantDAO.findAll();
        } catch (SQLException ex) {
            Logger.getLogger(FrmEcoPag.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        for (Map.Entry<Integer, Participant> entry : myMapParticipant.entrySet()) {
            ComboBoxParticipants.addItem(entry.getValue());
        }
    }
    private void LoadCBoxMoniteurs() {
        


        MoniteurDAO myMoniteurDAO = new MoniteurDAO(ConnexionDB.getInstance());
        myMapMoniteur.clear();
        ComboBoxMoniteurs.removeAllItems();
        try {
            myMapMoniteur = myMoniteurDAO.findAll();
        } catch (SQLException ex) {
            Logger.getLogger(FrmEcoPag.class.getName()).log(Level.SEVERE, null, ex);
        }

        for (Map.Entry<Integer, Moniteur> entry : myMapMoniteur.entrySet()) {
            ComboBoxMoniteurs.addItem(entry.getValue());
        }
    }

    private void loadExcursions() {
        try {
            ExcursionDAO myExcursionDAO = new ExcursionDAO(ConnexionDB.getInstance());
            myMapExcursion = myExcursionDAO.findAll();
        } catch (SQLException ex) {
            Logger.getLogger(FrmEcoPag.class.getName()).log(Level.SEVERE, null, ex);
        }

        while (TabExcursionModel.getRowCount() != 0) {
            TabExcursionModel.removeRow(0);
        }


        for (Map.Entry<Integer, Excursion> entry : myMapExcursion.entrySet()) {
            Vector myVector = new Vector();
            Excursion anExcursion = new Excursion();
            anExcursion = entry.getValue();
            myVector.add(anExcursion.getDate());
            myVector.add(anExcursion);
            myVector.add(anExcursion.getEmbarcadereDepart().getVille());
            myVector.add(anExcursion.getEmbarcadereDepart().getHeurePassage());
            myVector.add(anExcursion.getEmbarcadereArrivee().getVille());
            myVector.add(anExcursion.getEmbarcadereArrivee().getHeurePassage());
            myVector.add(anExcursion.getPrixPers());
            myVector.add(anExcursion.getNbPlaces());


            TabExcursionModel.addRow(myVector);

        }

    }

    private void initVariables() {
        myMapParticipant = new HashMap<Integer, Participant>();
        myMapMoniteur = new HashMap<Integer, Moniteur>();
        myMapExcursion = new HashMap<Integer, Excursion>();
        myMapEmbarcadere = new HashMap<Integer, Embarcadere>();
        myMapEmbarcation = new HashMap<Integer, Embarcation>();
        currentExcursion = new Excursion();
        TabExcursionModel = new DefaultTableModel();
        TabInscriptionModel = new DefaultTableModel();


    }

    private void loadInscriptionList() {
                 
        while (TabInscriptionModel.getRowCount() != 0) {
            TabInscriptionModel.removeRow(0);
        }

        myMapParticipant = currentExcursion.getParticipants();

        for (Map.Entry<Integer, Participant> entry : myMapParticipant.entrySet()) {
            Vector myVector = new Vector();
            Participant myParticipant = new Participant();
            myParticipant = entry.getValue();
            myVector.add(myParticipant);
            myVector.add(myParticipant.isInscrit());
            myVector.add(myParticipant.isLocation());

            TabInscriptionModel.addRow(myVector);

        }

    }

    private void loadEmbarcadereList() {
        EmbarcadereDAO myEmbarcadereDAO = new EmbarcadereDAO(ConnexionDB.getInstance());
        try {
            myMapEmbarcadere = myEmbarcadereDAO.findAll();
        } catch (SQLException ex) {
            Logger.getLogger(FrmEcoPag.class.getName()).log(Level.SEVERE, null, ex);
        }
        for (Map.Entry<Integer, Embarcadere> entry : myMapEmbarcadere.entrySet()) {
            EmbarcadereDepart.addItem(entry.getValue());
            EmbarcadereArrivee.addItem(entry.getValue());
        }
    }
    public void TabExcursionResfresh(){
         while (TabExcursionModel.getRowCount() != 0) {
            TabExcursionModel.removeRow(0);
        }
    for (Map.Entry<Integer, Excursion> entry : myMapExcursion.entrySet()) {
            Vector myVector = new Vector();
            Excursion anExcursion = new Excursion();
            anExcursion = entry.getValue();
            myVector.add(anExcursion.getDate());
            myVector.add(anExcursion);
            myVector.add(anExcursion.getEmbarcadereDepart().getVille());
            myVector.add(anExcursion.getEmbarcadereDepart().getHeurePassage());
            myVector.add(anExcursion.getEmbarcadereArrivee().getVille());
            myVector.add(anExcursion.getEmbarcadereArrivee().getHeurePassage());
            myVector.add(anExcursion.getPrixPers());
            myVector.add(anExcursion.getNbPlaces());

            TabExcursionModel.addRow(myVector);

        }
    }
}
